package com.xxcxcxcx.jobsystem.mixin.job.Cook;

import com.xxcxcxcx.jobsystem.Main;
import com.xxcxcxcx.jobsystem.common.Job.Cook.SetFood;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;

import static com.xxcxcxcx.jobsystem.common.Job.Cook.Cook.*;

@Mixin(Item.class)
public abstract class ItemMixin implements SetFood {

    public void setNewnutrition(ItemStack stack, int a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putInt(MakeFood+Newnutrition,a);
    }
    public void setNewsaturationModifier(ItemStack stack,float a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putFloat(MakeFood+Newsaturation,a);
    }
    public void setNewisMeat(ItemStack stack, boolean a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood+NewisMeat,a);
    }
    public void setNewcanAlwaysEat(ItemStack stack, boolean a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood+NewcanAlwaysEat,a);
    }
    public void setNewfastFood(ItemStack stack, boolean a){
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood+NewfastFood,a);
    }
    public void setEffect(ItemStack stack,MobEffect mobEffect, int time, int level, float chance){
        setNewcanAlwaysEat(stack,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood,true);
        stack.getOrCreateTagElement(Main.MOD_ID).putBoolean(MakeFood+Effect+ MobEffect.getId(mobEffect),true);
        stack.getOrCreateTagElement(Main.MOD_ID).putInt(MakeFood+Effect+ MobEffect.getId(mobEffect) +EffectTime,time);
        stack.getOrCreateTagElement(Main.MOD_ID).putInt(MakeFood+Effect+ MobEffect.getId(mobEffect) +EffectLevel,level);
        stack.getOrCreateTagElement(Main.MOD_ID).putFloat(MakeFood+Effect+ MobEffect.getId(mobEffect) +EffectChance,chance);
    }
    public void setCook(ItemStack stack, Player player,int Level){
        stack.getOrCreateTagElement(Main.MOD_ID).putString(MakeFood+Cooker, player.getName().getContents());
        stack.getOrCreateTagElement(Main.MOD_ID).putInt(MakeFood+CookLevel, Level);
        stack.getOrCreateTagElement(Main.MOD_ID).putString(MakeFood+FoodLevel, UnIdentification);
    }
}
